package com.weipai.springboot.module.controller;

import com.weipai.springboot.model.api.Response;
import com.weipai.springboot.module.service.DataStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 曹朋飞
 * @Date: 2018/09/17 14:20
 */
@RestController
public class DataStatisticsController {
    
    @Autowired
    private DataStatisticsService dataStatisticsService;

    /**
     * 首页数据展示
     * @return
     */
    @GetMapping("/dataStatistics/homePage")
    public Response getHomepageData(){
        return dataStatisticsService.getHomepageData();
    }

    /**
     * 订单报表
     * @param time
     * @return
     */
    @GetMapping("/dataStatistics/orderStatement/{time}")
    public Response orderStatement(@PathVariable("time") String time){
        return dataStatisticsService.orderStatement(time);
    }

    /**
     * 商家结算报表
     * @return
     */
    @GetMapping("/dataStatistics/shopStatement/{page}/{size}/{draw}")
    public Response shopStatement(@PathVariable("page") Integer page, @PathVariable("size") Integer size,
                                  @PathVariable("draw") String draw){
        return dataStatisticsService.shopStatement(page, size, draw);
    }

    /**
     * 需求报表
     * @param time
     * @return
     */
    @GetMapping("/dataStatistics/demandStatement/{time}/{demandCategoryId}")
    public Response demandStatement(@PathVariable("time") String time, @PathVariable("demandCategoryId") String demandCategoryId){
        return dataStatisticsService.demandStatement(time, demandCategoryId);
    }

    /**
     * 商品报表
     * @param page
     * @param size
     * @param draw
     * @return
     */
    @GetMapping("/dataStatistics/goodsStatement/{page}/{size}/{draw}")
    public Response goodsStatement(@PathVariable("page") Integer page, @PathVariable("size") Integer size,
                                   @PathVariable("draw") String draw){
        return dataStatisticsService.goodsStatement(page, size, draw);
    }

    /**
     * 员工的收益报表
     * @param page
     * @param size
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/dataStatistics/employeeStatement")
    public Response employeeStatement(@RequestParam(value = "page", required = false) Integer page,
                                      @RequestParam(value = "size", required = false) Integer size,
                                      @RequestParam(value = "startTime", required = false) String startTime,
                                      @RequestParam(value = "endTime", required = false) String endTime,
                                      @RequestParam(value = "draw", required = false) String draw,
                                      @RequestParam(value = "customerId", required = false) String customerId){
        return dataStatisticsService.employeeStatement(page, size, startTime, endTime, draw, customerId);
    }

    /**
     * 所有员工的收益
     * @param page
     * @param size
     * @param draw
     * @return
     */
    @GetMapping("/dataStatistics/allEmployeeStatement/{page}/{size}/{draw}")
    public Response allEmployeeStatement(@PathVariable("page") Integer page,
                                         @PathVariable("size") Integer size,
                                         @PathVariable("draw") String draw){
        return dataStatisticsService.allEmployeeStatement(page, size, draw);
    }

    /**
     * 技工的所有收益
     * @param page
     * @param size
     * @param draw
     * @return
     */
    @GetMapping("artisanStatement/{page}/{size}/{draw}")
    public Response artisanStatement(@PathVariable("page") Integer page,
                                     @PathVariable("size") Integer size,
                                     @PathVariable("draw") String draw){
        return dataStatisticsService.artisanStatement(page, size, draw);
    }

    /**
     * 技工的收益明细
     * @param page
     * @param size
     * @param startTime
     * @param endTime
     * @return
     */
    @GetMapping("/dataStatistics/artisanInfoStatement")
    public Response artisanInfoStatement(@RequestParam(value = "page", required = false) Integer page,
                                      @RequestParam(value = "size", required = false) Integer size,
                                      @RequestParam(value = "startTime", required = false) String startTime,
                                      @RequestParam(value = "endTime", required = false) String endTime,
                                      @RequestParam(value = "draw", required = false) String draw,
                                      @RequestParam(value = "artisanId", required = false) String artisanId){
        return dataStatisticsService.artisanInfoStatement(page, size, startTime, endTime, draw, artisanId);
    }
    
    
    
}
